<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Object</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            Object 
            
                <span class="parent">&lt; 
                    
                    BasicObject
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/kernel/agnostics_rb.html">activesupport/lib/active_support/core_ext/kernel/agnostics.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/load_error_rb.html">activesupport/lib/active_support/core_ext/load_error.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/acts_like_rb.html">activesupport/lib/active_support/core_ext/object/acts_like.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/blank_rb.html">activesupport/lib/active_support/core_ext/object/blank.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/deep_dup_rb.html">activesupport/lib/active_support/core_ext/object/deep_dup.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/duplicable_rb.html">activesupport/lib/active_support/core_ext/object/duplicable.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/inclusion_rb.html">activesupport/lib/active_support/core_ext/object/inclusion.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/instance_variables_rb.html">activesupport/lib/active_support/core_ext/object/instance_variables.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/to_json_rb.html">activesupport/lib/active_support/core_ext/object/to_json.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/to_param_rb.html">activesupport/lib/active_support/core_ext/object/to_param.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/to_query_rb.html">activesupport/lib/active_support/core_ext/object/to_query.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/try_rb.html">activesupport/lib/active_support/core_ext/object/try.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/with_options_rb.html">activesupport/lib/active_support/core_ext/object/with_options.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/string/output_safety_rb.html">activesupport/lib/active_support/core_ext/string/output_safety.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/uri_rb.html">activesupport/lib/active_support/core_ext/uri.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/json/encoding_rb.html">activesupport/lib/active_support/json/encoding.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/xml_mini/jdom_rb.html">activesupport/lib/active_support/xml_mini/jdom.rb</a></li>
            
            <li><a href="../files/actionpack/lib/action_controller/deprecated_rb.html">actionpack/lib/action_controller/deprecated.rb</a></li>
            
            <li><a href="../files/actionpack/lib/action_controller/deprecated/integration_test_rb.html">actionpack/lib/action_controller/deprecated/integration_test.rb</a></li>
            
            <li><a href="../files/actionpack/lib/action_dispatch/http/mime_types_rb.html">actionpack/lib/action_dispatch/http/mime_types.rb</a></li>
            
            <li><a href="../files/railties/lib/rails/test_help_rb.html">railties/lib/rails/test_help.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  
    <!-- Namespace -->
    <div class="sectiontitle">Namespace</div>
    <ul>
      
        <li>
          <span class="type">CLASS</span>
          <a href="LoadError.html">Object::MissingSourceFile</a>
        </li>
      
    </ul>
  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>A</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Object.html#method-i-acts_like-3F">acts_like?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>B</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Object.html#method-i-blank-3F">blank?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Object.html#method-i-create_fixtures">create_fixtures</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Object.html#method-i-deep_dup">deep_dup</a>,
              </li>
            
              
              <li>
                <a href="Object.html#method-i-duplicable-3F">duplicable?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>H</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Object.html#method-i-html_safe-3F">html_safe?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Object.html#method-i-in-3F">in?</a>,
              </li>
            
              
              <li>
                <a href="Object.html#method-i-instance_values">instance_values</a>,
              </li>
            
              
              <li>
                <a href="Object.html#method-i-instance_variable_names">instance_variable_names</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>P</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Object.html#method-i-presence">presence</a>,
              </li>
            
              
              <li>
                <a href="Object.html#method-i-present-3F">present?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Object.html#method-i-to_json">to_json</a>,
              </li>
            
              
              <li>
                <a href="Object.html#method-i-to_param">to_param</a>,
              </li>
            
              
              <li>
                <a href="Object.html#method-i-to_query">to_query</a>,
              </li>
            
              
              <li>
                <a href="Object.html#method-i-try">try</a>,
              </li>
            
              
              <li>
                <a href="Object.html#method-i-try-21">try!</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>U</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Object.html#method-i-unescape">unescape</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>W</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Object.html#method-i-with_options">with_options</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  
    <!-- Includes -->
    <div class="sectiontitle">Included Modules</div>
    <ul>
      
        <li>
          
            Java
          
        </li>
      
    </ul>
  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">MissingSourceFile</td>
            <td>=</td>
            <td class="attr-value">LoadError</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">AbstractRequest</td>
            <td>=</td>
            <td class="attr-value">ActionController::Request = ActionDispatch::Request</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">AbstractResponse</td>
            <td>=</td>
            <td class="attr-value">ActionController::Response = ActionDispatch::Response</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">Routing</td>
            <td>=</td>
            <td class="attr-value">ActionDispatch::Routing</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">Integration</td>
            <td>=</td>
            <td class="attr-value">ActionDispatch::Integration</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">IntegrationTest</td>
            <td>=</td>
            <td class="attr-value">ActionDispatch::IntegrationTest</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">ALL</td>
            <td>=</td>
            <td class="attr-value">Mime::Type.new(&quot;*/*&quot;, :all, [])</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-acts_like-3F">
            
              <b>acts_like?</b>(duck)
            
            <a href="Object.html#method-i-acts_like-3F" name="method-i-acts_like-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>A duck-type assistant method. For example, Active Support extends <a
href="Date.html">Date</a> to define an <code>acts_like_date?</code> method,
and extends <a href="Time.html">Time</a> to define
<code>acts_like_time?</code>. As a result, we can do
<code>x.acts_like?(:time)</code> and <code>x.acts_like?(:date)</code> to do
duck-type-safe comparisons, since classes that we want to act like <a
href="Time.html">Time</a> simply need to define an
<code>acts_like_time?</code> method.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-acts_like-3F_source')" id="l_method-i-acts_like-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cab6ba4e1bf2abf6a5fb83f2f28e2a8482350bbd/activesupport/lib/active_support/core_ext/object/acts_like.rb#L7" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-acts_like-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/acts_like.rb, line 7</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">acts_like?</span>(<span class="ruby-identifier">duck</span>)
  <span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:&quot;acts_like_#{duck}?&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-blank-3F">
            
              <b>blank?</b>()
            
            <a href="Object.html#method-i-blank-3F" name="method-i-blank-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>An object is blank if it’s false, empty, or a whitespace string. For
example, ”, ‘   ’, <code>nil</code>, [], and {} are all blank.</p>

<p>This simplifies:</p>

<pre>if address.nil? || address.empty?</pre>

<p>…to:</p>

<pre>if address.blank?</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-blank-3F_source')" id="l_method-i-blank-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/object/blank.rb#L13" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-blank-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/blank.rb, line 13</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">blank?</span>
  <span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:empty?</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">empty?</span> <span class="ruby-operator">:</span> <span class="ruby-operator">!</span><span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-create_fixtures">
            
              <b>create_fixtures</b>(*fixture_set_names, &amp;block)
            
            <a href="Object.html#method-i-create_fixtures" name="method-i-create_fixtures" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-create_fixtures_source')" id="l_method-i-create_fixtures_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/3e71f5759aace5aae16e2ad12108cdabc41944c4/railties/lib/rails/test_help.rb#L22" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-create_fixtures_source" class="dyn-source">
                <pre><span class="ruby-comment"># File railties/lib/rails/test_help.rb, line 22</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">create_fixtures</span>(*<span class="ruby-identifier">fixture_set_names</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-constant">FixtureSet</span>.<span class="ruby-identifier">create_fixtures</span>(<span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">TestCase</span>.<span class="ruby-identifier">fixture_path</span>, <span class="ruby-identifier">fixture_set_names</span>, {}, &amp;<span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-deep_dup">
            
              <b>deep_dup</b>()
            
            <a href="Object.html#method-i-deep_dup" name="method-i-deep_dup" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a deep copy of object if it’s duplicable. If it’s not duplicable,
returns <code>self</code>.</p>

<pre class="ruby"><span class="ruby-identifier">object</span> = <span class="ruby-constant">Object</span>.<span class="ruby-identifier">new</span>
<span class="ruby-identifier">dup</span>    = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">deep_dup</span>
<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">instance_variable_set</span>(:<span class="ruby-ivar">@a</span>, <span class="ruby-value">1</span>)

<span class="ruby-identifier">object</span>.<span class="ruby-identifier">instance_variable_defined?</span>(:<span class="ruby-ivar">@a</span>) <span class="ruby-comment">#=&gt; false</span>
<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">instance_variable_defined?</span>(:<span class="ruby-ivar">@a</span>)    <span class="ruby-comment">#=&gt; true</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-deep_dup_source')" id="l_method-i-deep_dup_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/019df9887519701b321c668c1d27d5c0c26fee7a/activesupport/lib/active_support/core_ext/object/deep_dup.rb#L13" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-deep_dup_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/deep_dup.rb, line 13</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">deep_dup</span>
  <span class="ruby-identifier">duplicable?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">dup</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-duplicable-3F">
            
              <b>duplicable?</b>()
            
            <a href="Object.html#method-i-duplicable-3F" name="method-i-duplicable-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Can you safely dup this object?</p>

<p>False for <code>nil</code>, <code>false</code>, <code>true</code>, symbol,
and number objects; true otherwise.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-duplicable-3F_source')" id="l_method-i-duplicable-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/object/duplicable.rb#L24" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-duplicable-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/duplicable.rb, line 24</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">duplicable?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-html_safe-3F">
            
              <b>html_safe?</b>()
            
            <a href="Object.html#method-i-html_safe-3F" name="method-i-html_safe-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-html_safe-3F_source')" id="l_method-i-html_safe-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L72" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-html_safe-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 72</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">html_safe?</span>
  <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-in-3F">
            
              <b>in?</b>(*args)
            
            <a href="Object.html#method-i-in-3F" name="method-i-in-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns true if this object is included in the argument. Argument must be
any object which responds to <code>#include?</code>. Usage:</p>

<pre class="ruby"><span class="ruby-identifier">characters</span> = [<span class="ruby-string">&quot;Konata&quot;</span>, <span class="ruby-string">&quot;Kagami&quot;</span>, <span class="ruby-string">&quot;Tsukasa&quot;</span>]
<span class="ruby-string">&quot;Konata&quot;</span>.<span class="ruby-identifier">in?</span>(<span class="ruby-identifier">characters</span>) <span class="ruby-comment"># =&gt; true</span>
</pre>

<p>This will throw an ArgumentError if the argument doesn’t respond to
<code>#include?</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-in-3F_source')" id="l_method-i-in-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/c6ef49f461b4a1c13e084ff3cf263e08ab48aa16/activesupport/lib/active_support/core_ext/object/inclusion.rb#L12" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-in-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/inclusion.rb, line 12</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">in?</span>(*<span class="ruby-identifier">args</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-number">1</span>
    <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;Calling #in? with multiple arguments is&quot;</span>          <span class="ruby-node">&quot; deprecated, please pass in an object that responds to #include? instead.&quot;</span>
    <span class="ruby-identifier">args</span>.<span class="ruby-identifier">include?</span> <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">another_object</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">another_object</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:include?</span>
      <span class="ruby-identifier">another_object</span>.<span class="ruby-identifier">include?</span> <span class="ruby-keyword">self</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span> <span class="ruby-string">'The single parameter passed to #in? must respond to #include?'</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-instance_values">
            
              <b>instance_values</b>()
            
            <a href="Object.html#method-i-instance_values" name="method-i-instance_values" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a hash with string keys that maps instance variable names without
“@” to their corresponding values.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">C</span>
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>)
    <span class="ruby-ivar">@x</span>, <span class="ruby-ivar">@y</span> = <span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">C</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">instance_values</span> <span class="ruby-comment"># =&gt; {&quot;x&quot; =&gt; 0, &quot;y&quot; =&gt; 1}</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-instance_values_source')" id="l_method-i-instance_values_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/94a636f8ae08c8b7ec36fd46b059f06e11849649/activesupport/lib/active_support/core_ext/object/instance_variables.rb#L12" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-instance_values_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/instance_variables.rb, line 12</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">instance_values</span>
  <span class="ruby-constant">Hash</span>[<span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">name</span>[<span class="ruby-number">1</span><span class="ruby-operator">..</span><span class="ruby-number">-1</span>], <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-identifier">name</span>)] }]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-instance_variable_names">
            
              <b>instance_variable_names</b>()
            
            <a href="Object.html#method-i-instance_variable_names" name="method-i-instance_variable_names" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns an array of instance variable names as strings including “@”.</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">C</span>
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>)
    <span class="ruby-ivar">@x</span>, <span class="ruby-ivar">@y</span> = <span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">C</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>, <span class="ruby-value">1</span>).<span class="ruby-identifier">instance_variable_names</span> <span class="ruby-comment"># =&gt; [&quot;@y&quot;, &quot;@x&quot;]</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-instance_variable_names_source')" id="l_method-i-instance_variable_names_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/94a636f8ae08c8b7ec36fd46b059f06e11849649/activesupport/lib/active_support/core_ext/object/instance_variables.rb#L25" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-instance_variable_names_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/instance_variables.rb, line 25</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">instance_variable_names</span>
  <span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">var</span><span class="ruby-operator">|</span> <span class="ruby-identifier">var</span>.<span class="ruby-identifier">to_s</span> }
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-presence">
            
              <b>presence</b>()
            
            <a href="Object.html#method-i-presence" name="method-i-presence" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns object if it’s <code>present?</code> otherwise returns
<code>nil</code>. <code>object.presence</code> is equivalent to
<code>object.present? ? object : nil</code>.</p>

<p>This is handy for any representation of objects where blank is the same as
not present at all. For example, this simplifies a common check for HTTP
POST/query parameters:</p>

<pre>state   = params[:state]   if params[:state].present?
country = params[:country] if params[:country].present?
region  = state || country || 'US'</pre>

<p>…becomes:</p>

<pre>region = params[:state].presence || params[:country].presence || 'US'</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-presence_source')" id="l_method-i-presence_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/object/blank.rb#L36" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-presence_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/blank.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">presence</span>
  <span class="ruby-keyword">self</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">present?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-present-3F">
            
              <b>present?</b>()
            
            <a href="Object.html#method-i-present-3F" name="method-i-present-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>An object is present if it’s not <code>blank?</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-present-3F_source')" id="l_method-i-present-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/object/blank.rb#L18" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-present-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/blank.rb, line 18</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">present?</span>
  <span class="ruby-operator">!</span><span class="ruby-identifier">blank?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_json">
            
              <b>to_json</b>(options = nil)
            
            <a href="Object.html#method-i-to_json" name="method-i-to_json" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Dumps object in JSON (JavaScript <a href="Object.html">Object</a>
Notation). See <a href="http://www.json.org">www.json.org</a> for more
info.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_json_source')" id="l_method-i-to_json_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/afe96542977ed52d0e80164b5079b3e5541fdcdb/activesupport/lib/active_support/core_ext/object/to_json.rb#L15" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_json_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/to_json.rb, line 15</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_json</span>(<span class="ruby-identifier">options</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>.<span class="ruby-identifier">encode</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_param">
            
              <b>to_param</b>()
            
            <a href="Object.html#method-i-to_param" name="method-i-to_param" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Alias of <code>to_s</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_param_source')" id="l_method-i-to_param_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/03404936945b452b8e66e53e183973176dae8301/activesupport/lib/active_support/core_ext/object/to_param.rb#L3" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_param_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/to_param.rb, line 3</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_param</span>
  <span class="ruby-identifier">to_s</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_query">
            
              <b>to_query</b>(key)
            
            <a href="Object.html#method-i-to_query" name="method-i-to_query" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts an object into a string suitable for use as a URL query string,
using the given <code>key</code> as the param name.</p>

<p>Note: This method is defined as a default implementation for all Objects
for <a href="Hash.html#method-i-to_query">Hash#to_query</a> to work.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_query_source')" id="l_method-i-to_query_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/3a04e370e4cc016bb7b59fe6bb704e4ca37d62f3/activesupport/lib/active_support/core_ext/object/to_query.rb#L8" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_query_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/to_query.rb, line 8</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_query</span>(<span class="ruby-identifier">key</span>)
  <span class="ruby-identifier">require</span> <span class="ruby-string">'cgi'</span> <span class="ruby-keyword">unless</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">CGI</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">CGI</span><span class="ruby-operator">::</span><span class="ruby-identifier">escape</span>)
  <span class="ruby-node">&quot;#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-try">
            
              <b>try</b>(*a, &amp;b)
            
            <a href="Object.html#method-i-try" name="method-i-try" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Invokes the public method whose name goes as first argument just like
<code>public_send</code> does, except that if the receiver does not respond
to it the call returns <code>nil</code> rather than raising an exception.</p>

<p>This method is defined to be able to write</p>

<pre>@person.try(:name)</pre>

<p>instead of</p>

<pre>@person ? @person.name : nil</pre>

<p><code>try</code> returns <code>nil</code> when called on <code>nil</code>
regardless of whether it responds to the method:</p>

<pre class="ruby"><span class="ruby-keyword">nil</span>.<span class="ruby-identifier">try</span>(:<span class="ruby-identifier">to_i</span>) <span class="ruby-comment"># =&gt; nil, rather than 0</span>
</pre>

<p>Arguments and blocks are forwarded to the method if invoked:</p>

<pre class="ruby"><span class="ruby-ivar">@posts</span>.<span class="ruby-identifier">try</span>(:<span class="ruby-identifier">each_slice</span>, <span class="ruby-value">2</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
  <span class="ruby-operator">...</span>
<span class="ruby-keyword">end</span>
</pre>

<p>The number of arguments in the signature must match. If the object responds
to the method the call is attempted and <code>ArgumentError</code> is still
raised otherwise.</p>

<p>If <code>try</code> is called without arguments it yields the receiver to a
given block unless it is <code>nil</code>:</p>

<pre class="ruby"><span class="ruby-ivar">@person</span>.<span class="ruby-identifier">try</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
  <span class="ruby-operator">...</span>
<span class="ruby-keyword">end</span>
</pre>

<p>Please also note that <code>try</code> is defined on <code>Object</code>,
therefore it won’t work with instances of classes that do not have
<code>Object</code> among their ancestors, like direct subclasses of
<code>BasicObject</code>. For example, using <code>try</code> with
<code>SimpleDelegator</code> will delegate <code>try</code> to the target
instead of calling it on delegator itself.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-try_source')" id="l_method-i-try_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/b4fa6516c1fc81f7da2a92adee9634d2771b7df0/activesupport/lib/active_support/core_ext/object/try.rb#L41" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-try_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/try.rb, line 41</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">try</span>(*<span class="ruby-identifier">a</span>, &amp;<span class="ruby-identifier">b</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">public_send</span>(*<span class="ruby-identifier">a</span>, &amp;<span class="ruby-identifier">b</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">a</span>.<span class="ruby-identifier">first</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-try-21">
            
              <b>try!</b>(*a, &amp;b)
            
            <a href="Object.html#method-i-try-21" name="method-i-try-21" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Same as <a href="Object.html#method-i-try">try</a>, but will raise a
NoMethodError exception if the receiving is not nil and does not
implemented the tried method.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-try-21_source')" id="l_method-i-try-21_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/b4fa6516c1fc81f7da2a92adee9634d2771b7df0/activesupport/lib/active_support/core_ext/object/try.rb#L51" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-try-21_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/try.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">try!</span>(*<span class="ruby-identifier">a</span>, &amp;<span class="ruby-identifier">b</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">public_send</span>(*<span class="ruby-identifier">a</span>, &amp;<span class="ruby-identifier">b</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-unescape">
            
              <b>unescape</b>(str, escaped = /%[a-fA-F\d]{2}/)
            
            <a href="Object.html#method-i-unescape" name="method-i-unescape" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-unescape_source')" id="l_method-i-unescape_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/d8b06dc5c250f80687f3e9d5de77b6cdf106c8f0/activesupport/lib/active_support/core_ext/uri.rb#L9" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-unescape_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/uri.rb, line 9</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">unescape</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">escaped</span> = <span class="ruby-regexp">/%[a-fA-F\d]{2}/</span>)
  <span class="ruby-comment"># TODO: Are we actually sure that ASCII == UTF-8?</span>
  <span class="ruby-comment"># YK: My initial experiments say yes, but let's be sure please</span>
  <span class="ruby-identifier">enc</span> = <span class="ruby-identifier">str</span>.<span class="ruby-identifier">encoding</span>
  <span class="ruby-identifier">enc</span> = <span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">UTF_8</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">enc</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Encoding</span><span class="ruby-operator">::</span><span class="ruby-constant">US_ASCII</span>
  <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">escaped</span>) { [<span class="ruby-node">$&amp;</span>[<span class="ruby-number">1</span>, <span class="ruby-number">2</span>].<span class="ruby-identifier">hex</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-string">'C'</span>) }.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-identifier">enc</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-with_options">
            
              <b>with_options</b>(options)
            
            <a href="Object.html#method-i-with_options" name="method-i-with_options" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>An elegant way to factor duplication out of options passed to a series of
method calls. Each method called in the block, with the block variable as
the receiver, will have its options merged with the default
<code>options</code> hash provided. Each method called on the block
variable must take an options hash as its final argument.</p>

<p>Without <code>with_options&gt;</code>, this code contains duplication:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Account</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-identifier">has_many</span> :<span class="ruby-identifier">customers</span>, <span class="ruby-identifier">dependent</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">destroy</span>
  <span class="ruby-identifier">has_many</span> :<span class="ruby-identifier">products</span>,  <span class="ruby-identifier">dependent</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">destroy</span>
  <span class="ruby-identifier">has_many</span> :<span class="ruby-identifier">invoices</span>,  <span class="ruby-identifier">dependent</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">destroy</span>
  <span class="ruby-identifier">has_many</span> :<span class="ruby-identifier">expenses</span>,  <span class="ruby-identifier">dependent</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">destroy</span>
<span class="ruby-keyword">end</span>
</pre>

<p>Using <code>with_options</code>, we can remove the duplication:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Account</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-identifier">with_options</span> <span class="ruby-identifier">dependent</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">destroy</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">assoc</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">assoc</span>.<span class="ruby-identifier">has_many</span> :<span class="ruby-identifier">customers</span>
    <span class="ruby-identifier">assoc</span>.<span class="ruby-identifier">has_many</span> :<span class="ruby-identifier">products</span>
    <span class="ruby-identifier">assoc</span>.<span class="ruby-identifier">has_many</span> :<span class="ruby-identifier">invoices</span>
    <span class="ruby-identifier">assoc</span>.<span class="ruby-identifier">has_many</span> :<span class="ruby-identifier">expenses</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
</pre>

<p>It can also be used with an explicit receiver:</p>

<pre class="ruby"><span class="ruby-constant">I18n</span>.<span class="ruby-identifier">with_options</span> <span class="ruby-identifier">locale</span><span class="ruby-operator">:</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">locale</span>, <span class="ruby-identifier">scope</span><span class="ruby-operator">:</span> <span class="ruby-string">'newsletter'</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i18n</span><span class="ruby-operator">|</span>
  <span class="ruby-identifier">subject</span> <span class="ruby-identifier">i18n</span>.<span class="ruby-identifier">t</span> :<span class="ruby-identifier">subject</span>
  <span class="ruby-identifier">body</span>    <span class="ruby-identifier">i18n</span>.<span class="ruby-identifier">t</span> :<span class="ruby-identifier">body</span>, <span class="ruby-identifier">user_name</span><span class="ruby-operator">:</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">name</span>
<span class="ruby-keyword">end</span>
</pre>

<p><code>with_options</code> can also be nested since the call is forwarded to
its receiver. Each nesting level will merge inherited defaults in addition
to their own.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-with_options_source')" id="l_method-i-with_options_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f4e180578c673194f58d4ff5a4a656cc51b2249e/activesupport/lib/active_support/core_ext/object/with_options.rb#L39" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-with_options_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/with_options.rb, line 39</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">with_options</span>(<span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">yield</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">OptionMerger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    